<template>
  <div v-loading="listLoading">
    <el-card class="sun-el-card">
      <sunUpdataAdd :title="this.$route.meta.title" :tab-list="tabList" :tab-list-right="tabListRight" />
      <sunDetailPage v-if="obj_data" :data-key="tabItem.value === 'necg' ? necg_dataKey : ecg_dataKey" :data-detail="obj_data" :is-edit="false" :is-header="false" :is-button="false" :is-back="false" />
    </el-card>
    <el-dialog
      :width="tabItem.value === 'necg' ? '500px' : '970px'"
      class="sun-el-dialog"
      :destroy-on-close="true"
      :lock-scroll="true"
      :close-on-click-modal="false"
      :show-close="false"
      :visible.sync="show_dialog"
    >
      <el-form ref="refForm" :model="formData">
        <el-row :gutter="24">
          <el-col :span="tabItem.value === 'necg' ? 24 : 8">
            <el-form-item
              label="选择学年学期"
              prop="acad_year_term"
            >
              <el-select v-model="formData.acad_year_term" :disabled="!!formData.id" style="width: 100%" placeholder="请选择学年学期">
                <el-option
                  v-for="item in acad_year_term_list"
                  :key="item.acad_year_term"
                  :label="item.acad_year_term_name"
                  :value="item.acad_year_term"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <span v-if="tabItem.value === 'ecg'">
            <el-col :span="8">
              <el-form-item
                label="评价方式"
                prop="evaluation_course_group_method"
              >
                <el-select v-model="formData.evaluation_course_group_method" style="width: 100%" placeholder="请选择评价方式">
                  <el-option
                    v-for="group_method in method"
                    :key="group_method.id"
                    :label="group_method.label"
                    :value="group_method.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="打分方式"
                prop="evaluation_course_group_indicator_score_method"
              >
                <el-select v-model="formData.evaluation_course_group_indicator_score_method" style="width: 100%" placeholder="请选择打分方式">
                  <el-option
                    v-for="score_method in indicator_score_method"
                    :key="score_method.id"
                    :label="score_method.label"
                    :value="score_method.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
          </span>
        </el-row>
        <span v-if="tabItem.value === 'ecg'">
          <el-form-item
            label="是否给老师看"
            :rules="[
              { required: true, message: '请输入', trigger: 'blur' },
            ]"
          >
            <el-switch
              v-model="formData.evaluation_course_group_teacher_look_result"
              class="tableScopeSwitch"
              :active-value="1"
              :inactive-value="0"
              active-text="是"
              inactive-text="否"
            />
          </el-form-item>
          <div v-if="formData.evaluation_course_group_indicator_score_method === 1">
            <el-form-item
              label="等级系数"
              style="margin-bottom: 5px"
            >
              <el-button
                size="mini"
                style="position: absolute;top: 15%;left: 70px;padding: 6px 8px"
                @click="add_evaluation_course_group_item('indicator_grade_coefficient')"
              >
                <i class="el-icon-plus" />
                等级系数
              </el-button>
            </el-form-item>
            <el-card class="sun-el-card indicator-card">
              <div style="color: #939799;margin-bottom: 7px">{{ '等级系数 0.1 ~ 1 之间' }}</div>
              <span v-for="(coefficient, index) in indicator_grade_coefficient" :key="index">
                <el-input v-model="coefficient.centent" type="number" :min="0.1" :max="1" placeholder="请输入等级系数" :style="(index !== indicator_grade_coefficient.length - 1) ? 'margin-bottom: 14px' : ''">
                  <div slot="prepend" style="width: 50px">{{ coefficient.key }}</div>
                  <template slot="append">{{ coefficient.centent * 100 + '%' }}</template>
                </el-input>
              </span>
            </el-card>
          </div>
          <div style="margin-top: 20px">
            <el-form-item
              label="等级配置"
              style="margin-bottom: 5px"
            >
              <el-button
                size="mini"
                style="position: absolute;top: 15%;left: 70px;padding: 6px 8px"
                @click="add_evaluation_course_group_item('score_grade')"
              >
                <i class="el-icon-plus" />
                等级配置
              </el-button>
            </el-form-item>
            <el-card class="sun-el-card indicator-card">
              <span v-for="(score, index) in score_grade" :key="index">
                <div class="flex_between" :style="(index !== score_grade.length - 1) ? 'margin-bottom: 14px' : ''">
                  <el-input
                    v-model="score.key"
                    class="grade-style"
                    style="width: 50px"
                    readonly
                  ><div slot="prepend" style="width: 50px">{{ score.key }}</div>
                  </el-input>
                  <div v-if="score.key" class="flex_center_align" style="width: calc(100% - 130px)">
                    最小：<el-input-number v-model="score.min" :min="0" style="margin-right: 15px;" size="small" />
                    最大：<el-input-number v-model="score.max" style="margin-right: 15px;" size="small" />
                    <el-radio-group v-model="score.eq">
                      <el-radio label="l_r">{{ score.min }} {{ equal }} {{ score.key }} {{ equal }} {{ score.max }}</el-radio>
                      <el-radio label="l">{{ score.min }} {{ equal }} {{ score.key }} {{ lessThan }} {{ score.max }}</el-radio>
                      <el-radio label="r">{{ score.min }} {{ lessThan }} {{ score.key }} {{ equal }} {{ score.max }}</el-radio>
                    </el-radio-group>
                  </div>
                </div>
              </span>
            </el-card>
          </div>
          <div style="margin-top: 20px">
            <el-form-item
              label="等级有效期"
              style="margin-bottom: 5px"
            >
              <el-button
                size="mini"
                style="position: absolute;top: 15%;left: 100px;padding: 6px 8px"
                @click="add_evaluation_course_group_item('grade_validity')"
              >
                <i class="el-icon-plus" />
                等级有效期
              </el-button>
            </el-form-item>
            <el-card class="sun-el-card indicator-card">
              <span v-for="(item_validity, index) in grade_validity" :key="index">
                <el-input v-model="item_validity.centent" type="number" :min="0" placeholder="请输入等级系数" :style="(index !== grade_validity.length - 1) ? 'margin-bottom: 14px' : ''">
                  <div slot="prepend" style="width: 50px">{{ item_validity.key }}</div>
                  <template slot="append">年</template>
                </el-input>
              </span>
            </el-card>
          </div>
          <div style="margin-top: 20px">
            <el-form-item
              label="间隔年限"
              style="margin-bottom: 5px"
            >
              <el-button
                size="mini"
                style="position: absolute;top: 15%;left: 70px;padding: 6px 8px"
                @click="add_evaluation_course_group_item('grade_evaluation_interval')"
              >
                <i class="el-icon-plus" />
                间隔年限
              </el-button>
            </el-form-item>
            <el-card class="sun-el-card indicator-card">
              <span v-for="(grade_evaluation, index) in grade_evaluation_interval" :key="index">
                <el-input v-model="grade_evaluation.centent" type="number" :min="0" placeholder="请输入间隔年限" :style="(index !== grade_evaluation_interval.length - 1) ? 'margin-bottom: 14px' : ''">
                  <div slot="prepend" style="width: 50px">{{ grade_evaluation.key }}</div>
                  <template slot="append">年</template>
                </el-input>
              </span>
            </el-card>
          </div>
        </span>
        <span v-if="tabItem.value === 'necg'">
          <el-form-item
            label="是否给老师看"
            :rules="[
              { required: true, message: '请输入', trigger: 'blur' },
            ]"
          >
            <el-switch
              v-model="formData.new_evaluation_course_group_teacher_look_result"
              class="tableScopeSwitch"
              :active-value="1"
              :inactive-value="0"
              active-text="是"
              inactive-text="否"
            />
          </el-form-item>
          <el-form-item
            label="专家同意比例"
            style="margin-bottom: 5px"
          >
            <el-input v-model="formData.new_evaluation_course_group_consent_rate" :min="0.1" :max="1" type="number" placeholder="请输入专家同意比例" />
          </el-form-item>
          <el-form-item
            label="专家说课评审合格比例【无说课流程请忽略】"
            style="margin-bottom: 5px"
          >
            <el-input v-model="formData.new_evaluation_course_group_prelection_qualified_rate" :min="0.1" :max="1" type="number" placeholder="专家说课评审合格比例" />
          </el-form-item>
          <el-form-item
            style="margin-top: 20px;"
            label="意见字数"
            prop="new_comment_words_number"
          >
            <el-input-number v-model="formData.new_comment_words_number" size="small" />
          </el-form-item>
        </span>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" :disabled="requestLoading" @click="show_dialog = false">取 消</el-button>
        <el-button type="primary" size="small" :loading="requestLoading" @click="onFinish">完 成</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { get, put, post } from '@/api/request'
import SunUpdataAdd from '@/sun-components/SunUpdataAdd'
import { $tooltips } from '@/sun-components/SunMsg.js'
import SunDetailPage from '@/sun-components/SunDetailPage'

export default {
  name: 'PatternIndex',
  components: { SunUpdataAdd, SunDetailPage },
  data() {
    return {
      tabListRight: [
        { id: 1, old_id: 1, name: '编辑', value: 'edit', icon: 'el-icon-edit', type: 'primary', disabled: false }
      ],
      requestLoading: false,
      show_dialog: false,
      obj_data: null,
      ecg_dataKey: [
        { 'acad_year_term_name': '学年学期', show: 'acad_year_term_name', lg: 12, is_replace: false, type: 'text' },
        { 'evaluation_course_group_teacher_look_result': '老师查看', show: 'evaluation_course_group_teacher_look_result', lg: 12, is_replace: true, type: 'text' },
        { 'evaluation_course_group_method': '评价方式', show: 'evaluation_course_group_method', lg: 12, is_replace: true, type: 'text' },
        { 'evaluation_course_group_indicator_score_method': '打分方式', show: 'evaluation_course_group_indicator_score_method', lg: 12, is_replace: true, type: 'text' },
        { 'evaluation_course_group_score_grade': '等级配置', show: 'evaluation_course_group_score_grade', lg: 24, is_replace: true, type: 'array' },
        { 'evaluation_course_group_indicator_grade_coefficient': '等级系数', show: 'evaluation_course_group_indicator_grade_coefficient', lg: 24, is_replace: true, type: 'array' },
        { 'evaluation_course_group_grade_validity': '等级有效期', show: 'evaluation_course_group_grade_validity', lg: 24, is_replace: true, type: 'array' },
        { 'evaluation_course_group_grade_evaluation_interval': '间隔年限', show: 'evaluation_course_group_grade_evaluation_interval', lg: 24, is_replace: true, type: 'array' }
      ],
      necg_dataKey: [
        { 'acad_year_term_name': '学年学期', show: 'acad_year_term_name', lg: 24, is_replace: false, type: 'text' },
        { 'new_evaluation_course_group_teacher_look_result': '老师查看', show: 'new_evaluation_course_group_teacher_look_result', lg: 24, is_replace: true, type: 'text' },
        { 'new_evaluation_course_group_consent_rate': '同意比例', show: 'new_evaluation_course_group_consent_rate', lg: 24, is_replace: false, type: 'text' },
        { 'new_evaluation_course_group_prelection_qualified_rate': '说课评审合格比例', show: 'new_evaluation_course_group_prelection_qualified_rate', lg: 24, is_replace: false, type: 'text' },
        { 'new_comment_words_number': '意见字数', show: 'new_comment_words_number', lg: 24, is_replace: true, type: 'text' }
      ],
      lessThan: '<',
      equal: '≤',
      tabList: [
        { id: 1, old_id: 1, name: '课程评价', value: 'ecg', type: 'primary' },
        { id: 2, old_id: 1, name: '准入评价', value: 'necg', type: 'mini' }
      ],
      tabItem: { id: 1, old_id: 1, name: '课程评价', value: 'ecg', type: 'primary' },
      method: [
        { id: 1, 'label': '指标评定', 'value': 1 },
        { id: 2, 'label': '等级评定', 'value': 2 }
      ],
      indicator_score_method: [
        { id: 1, 'label': '等级', 'value': 1 },
        { id: 2, 'label': '分数', 'value': 2 }
      ],
      gradeList: ['A', 'B', 'C', 'D'],
      grade_evaluation_interval: [{ 'key': '', 'centent': 0 }],
      grade_validity: [{ 'key': '', 'centent': 0 }],
      indicator_grade_coefficient: [{ 'key': '', 'centent': 0.1 }],
      score_grade: [{ 'key': '', 'min': 1, 'max': 100, 'eq': 'l_r' }],
      submitData: ['indicator_grade_coefficient', 'score_grade', 'grade_validity', 'grade_evaluation_interval'],
      listLoading: true,
      acad_year_term_list: [],
      formData: {}
    }
  },
  created() {
    this.upData()
    this.get_acad_year_term()
  },
  methods: {
    addData() {
      const _that = this
      _that.$set(_that, 'formData', {})
      _that.$set(_that.formData, 'id', '')
      _that.acad_year_term_list.forEach(item => {
        if (item.is_now) {
          _that.$set(_that.formData, 'acad_year_term', item.acad_year_term)
        }
      })
      if (_that.tabItem.value === 'ecg') {
        _that.$set(_that.formData, 'evaluation_course_group_teacher_look_result', 1)
        _that.$set(_that.formData, 'evaluation_course_group_indicator_score_method', 1)
        _that.$set(_that.formData, 'evaluation_course_group_method', 1)
        _that.$set(_that.formData, 'evaluation_course_group_indicator_grade_coefficient', {})
        _that.$set(_that.formData, 'evaluation_course_group_score_grade', {})
        _that.$set(_that.formData, 'evaluation_course_group_grade_validity', {})
        _that.$set(_that.formData, 'evaluation_course_group_grade_evaluation_interval', {})
        _that.grade_evaluation_interval = [{ 'key': 'A', 'centent': 0 }]
        _that.grade_validity = [{ 'key': 'A', 'centent': 0 }]
        _that.indicator_grade_coefficient = [{ 'key': 'A', 'centent': 0 }]
        _that.score_grade = [{ 'key': 'A', 'min': 1, 'max': 100, 'eq': 'l_r' }]
      }
      if (_that.tabItem.value === 'necg') {
        _that.$set(_that.formData, 'new_evaluation_course_group_consent_rate', 0.1)
        _that.$set(_that.formData, 'new_evaluation_course_group_prelection_qualified_rate', 0.1)
        _that.$set(_that.formData, 'new_evaluation_course_group_teacher_look_result', 1)
        _that.$set(_that.formData, 'new_comment_words_number', 0)
      }
      _that.show_dialog = true
    },
    async tabHeaderBtn(id) {
      const _that = this
      _that.$set(_that, 'formData', {})
      _that.$set(_that.formData, 'id', JSON.stringify(_that.obj_data.id))
      _that.$set(_that.formData, 'acad_year_term', _that.obj_data.acad_year_term)
      if (_that.tabItem.value === 'necg') {
        _that.$set(_that.formData, 'new_comment_words_number', _that.obj_data.new_comment_words_number)
        _that.$set(_that.formData, 'new_evaluation_course_group_teacher_look_result', _that.obj_data.new_evaluation_course_group_teacher_look_result)
        _that.$set(_that.formData, 'new_evaluation_course_group_consent_rate', _that.obj_data.new_evaluation_course_group_consent_rate)
        _that.$set(_that.formData, 'new_evaluation_course_group_prelection_qualified_rate', _that.obj_data.new_evaluation_course_group_prelection_qualified_rate)
      }
      if (_that.tabItem.value === 'ecg') {
        _that.$set(_that.formData, 'evaluation_course_group_grade_evaluation_interval', {})
        _that.$set(_that.formData, 'evaluation_course_group_grade_validity', {})
        _that.$set(_that.formData, 'evaluation_course_group_score_grade', {})
        _that.$set(_that.formData, 'evaluation_course_group_indicator_grade_coefficient', {})
        _that.$set(_that.formData, 'evaluation_course_group_teacher_look_result', _that.obj_data.evaluation_course_group_teacher_look_result)
        _that.$set(_that.formData, 'evaluation_course_group_method', _that.obj_data.evaluation_course_group_method)
        _that.$set(_that.formData, 'evaluation_course_group_indicator_score_method', _that.obj_data.evaluation_course_group_indicator_score_method)
        if (_that.obj_data.evaluation_course_group_indicator_grade_coefficient) {
          this.indicator_grade_coefficient = []
          const indicator_grade_coefficient_values = Object.values(_that.obj_data.evaluation_course_group_indicator_grade_coefficient)
          Object.keys(_that.obj_data.evaluation_course_group_indicator_grade_coefficient).forEach((item, index) => {
            this.indicator_grade_coefficient.push({ key: item, centent: indicator_grade_coefficient_values[index] })
          })
        }
        if (_that.obj_data.evaluation_course_group_score_grade) {
          this.score_grade = []
          const score_grade_values = Object.values(_that.obj_data.evaluation_course_group_score_grade)
          Object.keys(_that.obj_data.evaluation_course_group_score_grade).forEach((item, index) => {
            this.score_grade.push({ key: item, min: score_grade_values[index].min, max: score_grade_values[index].max, eq: score_grade_values[index].eq })
          })
        }
        if (_that.obj_data.evaluation_course_group_grade_validity) {
          this.grade_validity = []
          const grade_validity_values = Object.values(_that.obj_data.evaluation_course_group_grade_validity)
          Object.keys(_that.obj_data.evaluation_course_group_grade_validity).forEach((item, index) => {
            this.grade_validity.push({ key: item, centent: grade_validity_values[index] })
          })
        }
        if (_that.obj_data.evaluation_course_group_grade_evaluation_interval) {
          this.grade_evaluation_interval = []
          const grade_evaluation_interval_values = Object.values(_that.obj_data.evaluation_course_group_grade_evaluation_interval)
          Object.keys(_that.obj_data.evaluation_course_group_grade_evaluation_interval).forEach((item, index) => {
            this.grade_evaluation_interval.push({ key: item, centent: grade_evaluation_interval_values[index] })
          })
        }
      }
      _that.show_dialog = true
    },
    add_evaluation_course_group_item(list) {
      if (this[list].length === this.gradeList.length) return
      switch (list) {
        case 'indicator_grade_coefficient':
          if (this[list][this[list].length - 1].centent) {
            this[list].push({ 'key': this.gradeList[this[list].length], 'centent': 0 })
          } else {
            $tooltips('还有 等级系数 等级尚未选择', 'warning')
          }
          break
        case 'score_grade':
          if (this[list][this[list].length - 1].min === 1 && this[list][this[list].length - 1].max === 100) {
            $tooltips('还有 等级配置 等级尚未选择', 'warning')
          } else if (this[list][this[list].length - 1].min >= this[list][this[list].length - 1].max) {
            $tooltips('等级配置错误,最小值不能大于等于最大值', 'warning')
          } else {
            this[list].push({ 'key': this.gradeList[this[list].length], 'min': 1, 'max': this[list][this[list].length - 1].min, 'eq': 'l_r' })
          }
          break
        case 'grade_validity':
          if (this[list][this[list].length - 1].centent) {
            this[list].push({ 'key': this.gradeList[this[list].length], 'centent': 0 })
          } else {
            $tooltips('还有 等级有效期 等级尚未选择', 'warning')
          }
          break
        case 'grade_evaluation_interval':
          if (this[list][this[list].length - 1].centent) {
            this[list].push({ 'key': this.gradeList[this[list].length], 'centent': 0 })
          } else {
            $tooltips('还有 间隔年限 等级尚未选择', 'warning')
          }
          break
      }
    },
    upData() {
      this.requestData()
    },
    async get_acad_year_term() {
      await get(`acad-year-term?method=post`).then(response => {
        if (response.code === 0) {
          this.acad_year_term_list = response.data
        }
      })
    },
    async tabHeaderSelect(id) {
      const _that = this
      _that.tabList?.forEach((item) => {
        if (item.old_id === id) {
          return false
        }
        _that.obj_data = null
        if (item.id === id) {
          item.type = 'primary'
          _that.tabItem = item
          _that.upData()
        } else {
          item.type = 'mini'
        }
        item.old_id = id
      })
    },
    async onFinish() {
      const _that = this
      if (_that.formData.new_evaluation_course_group_consent_rate) {
        if (Number(_that.formData.new_evaluation_course_group_consent_rate) > 1) {
          $tooltips('专家同意比例不能大于 1', 'warning')
          return
        }
        if (Number(_that.formData.new_evaluation_course_group_consent_rate) <= 0) {
          $tooltips('专家同意比例不能小于等于 0', 'warning')
          return
        }
      }
      if (_that.formData.new_evaluation_course_group_prelection_qualified_rate) {
        if (Number(_that.formData.new_evaluation_course_group_prelection_qualified_rate) > 1) {
          $tooltips('专家说课评审合格比例不能大于 1', 'warning')
          return
        }
        if (Number(_that.formData.new_evaluation_course_group_prelection_qualified_rate) <= 0) {
          $tooltips('专家说课评审合格比例不能小于等于 0', 'warning')
          return
        }
      }
      const id = _that.formData.id ? _that.formData.id : false
      if (_that.tabItem.value === 'ecg') {
        _that.submitData.forEach(item => {
          _that[item].forEach(el => {
            if (el.eq) {
              if (el.key) {
                console.log('item', item)
                Object.assign(_that.formData[`evaluation_course_group_${item}`], { [el.key]: { min: el.min, max: el.max, eq: el.eq }})
              }
            } else {
              if (el.key) {
                console.log('item', item)
                Object.assign(_that.formData[`evaluation_course_group_${item}`], { [el.key]: el.centent })
              }
            }
          })
        })
      }
      _that.requestLoading = true
      if (id) {
        put(`evaluation/course/setting/${_that.tabItem.value}/${id}`, _that.formData).then(response => {
          if (response.code === 0) {
            _that.show_dialog = false
            _that.upData()
          }
          _that.requestLoading = false
        })
      } else {
        post(`evaluation/course/setting/${_that.tabItem.value}`, _that.formData).then(response => {
          if (response.code === 0) {
            _that.show_dialog = false
            _that.upData()
          }
          _that.requestLoading = false
        })
      }
    },
    async requestData() {
      this.listLoading = true
      await get(`evaluation/course/setting/${this.tabItem.value}`, {}, { all: 1 }).then(response => {
        if (response.code === 0) {
          switch (this.tabItem.value) {
            case 'ecg':
              response.data['evaluation_course_group_teacher_look_result_value'] = response.data.evaluation_course_group_teacher_look_result === 1 ? '允许' : '不允许'
              response.data['evaluation_course_group_method_value'] = response.data.evaluation_course_group_method ? response.data.evaluation_course_group_method === 1 ? '指标评定' : '等级评定' : '暂无'
              response.data['evaluation_course_group_indicator_score_method_value'] = response.data.evaluation_course_group_indicator_score_method ? response.data.evaluation_course_group_indicator_score_method === 1 ? '等级' : '分数' : '暂无'
              response.data['evaluation_course_group_score_grade_array'] = []
              if (response.data.evaluation_course_group_score_grade) {
                const group_score_grade_key = Object.keys(response.data.evaluation_course_group_score_grade)
                const group_score_grade_value = Object.values(response.data.evaluation_course_group_score_grade)
                group_score_grade_value?.forEach((item, index) => {
                  switch (item.eq) {
                    case 'l_r':
                      response.data['evaluation_course_group_score_grade_array'].push(item.min + ' ' + this.equal + ' ' + group_score_grade_key[index] + ' ' + this.equal + ' ' + item.max)
                      break
                    case 'l':
                      response.data['evaluation_course_group_score_grade_array'].push(item.min + ' ' + this.equal + ' ' + group_score_grade_key[index] + ' ' + this.lessThan + ' ' + item.max)
                      break
                    case 'r':
                      response.data['evaluation_course_group_score_grade_array'].push(item.min + ' ' + this.lessThan + ' ' + group_score_grade_key[index] + ' ' + this.equal + ' ' + item.max)
                      break
                  }
                })
              }
              response.data['evaluation_course_group_indicator_grade_coefficient_array'] = []
              if (response.data.evaluation_course_group_indicator_grade_coefficient) {
                const group_grade_validity_key = Object.keys(response.data.evaluation_course_group_indicator_grade_coefficient)
                const group_grade_validity_value = Object.values(response.data.evaluation_course_group_indicator_grade_coefficient)
                group_grade_validity_value.forEach((item, index) => {
                  response.data['evaluation_course_group_indicator_grade_coefficient_array'].push(group_grade_validity_key[index] + ': ' + item)
                })
              }
              response.data['evaluation_course_group_grade_validity_array'] = []
              if (response.data.evaluation_course_group_grade_validity) {
                const group_grade_validity_key = Object.keys(response.data.evaluation_course_group_grade_validity)
                const group_grade_validity_value = Object.values(response.data.evaluation_course_group_grade_validity)
                group_grade_validity_value.forEach((item, index) => {
                  response.data['evaluation_course_group_grade_validity_array'].push(group_grade_validity_key[index] + ': ' + item + '年')
                })
              }
              response.data['evaluation_course_group_grade_evaluation_interval_array'] = []
              if (response.data.evaluation_course_group_grade_evaluation_interval) {
                const group_grade_validity_key = Object.keys(response.data.evaluation_course_group_grade_evaluation_interval)
                const group_grade_validity_value = Object.values(response.data.evaluation_course_group_grade_evaluation_interval)
                group_grade_validity_value.forEach((item, index) => {
                  response.data['evaluation_course_group_grade_evaluation_interval_array'].push(group_grade_validity_key[index] + ': ' + item + '年')
                })
              }
              break
            case 'necg':
              response.data['new_comment_words_number_value'] = response.data.new_comment_words_number > 0 ? response.data.new_comment_words_number : '无限制'
              response.data['new_evaluation_course_group_teacher_look_result_value'] = response.data.new_evaluation_course_group_teacher_look_result === 1 ? '允许' : '不允许'
              break
          }
          this.obj_data = response.data
        }
        this.listLoading = false
      })
    }
  }
}
</script>
<style lang="scss" scoped>
  @import '@/styles/sun-style.scss';
  .indicator-card{
    margin: 0 !important;
  }
  .grade-style ::v-deep {
    input{
      padding: 0 !important;
    }
    .el-input__inner{
      border-right: none !important;
    }
  }
</style>
